﻿/*******************************************************
* Autor: Oleg Rukin aka Keyki
********************************************************/

using System;
using System.Globalization;
using System.Linq;

namespace Keyki.WpfNefclas.Helpers
{
	public class InputHelper
	{
		static public void DecimalTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
		{
			e.Handled = !e.Text.All(Char.IsNumber);
		}//DecimalTextInput

		static public void FloatTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
		{
			e.Handled = !e.Text.All(cc => Char.IsNumber(cc) || cc == NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator.ToCharArray()[0]);
		}//FloatTextInput

	}//class InputHelper
}